<template>
	<view style="overflow: hidden;">
		<swiper indicator-dots circular autoplay interval="800">
			<swiper-item @click="todetail">
				<image src="../../static/QQ图片20210403172250.jpg" mode=""></image>
			</swiper-item>
			<swiper-item @click="todetail">
				<image src="../../static/QQ图片20210814225710.png"></image>
			</swiper-item>
			<swiper-item @click="todetail">
				<image src="../../static/滚出.png"></image>
			</swiper-item>
		</swiper>
		<!-- 导航开始 -->
		<view class="nav">
			<view class="nav_item" v-for="item in navs" @click="change(item.path)">
				<view class="icon">
					<view class="iconfont icon-index-fill"></view>
				</view>
				<text>{{item.title}}</text>
			</view>

		</view>
		<!-- 导航结束 -->
		<!-- 推荐商品开始 -->
		<goodlist :data-index=index>
			<view class="title">推荐商品</view>
		</goodlist>
		<!-- 推荐商品结束 -->
	</view>
</template>

<script>
	import goodlist from '../../components/goods-list'
	export default {
		components: {
			goodlist: goodlist
		},
		data() {
			return {
				index: 1,
				title: 'Hello',
				navs: [{
						title: '聆听超市',
						path: '/pages/shop/shop',
						icon: 'iconfont icon-index-fill'
					}, {
						title: '联系我们',
						path: '/pages/contact/contact',
						icon: 'iconfont icon-index-fill'
					}, {
						title: '商品分类',
						path: '/pages/category/category',
						icon: 'iconfont icon-index-fill'
					}, {
						title: '学习视频',
						path: '/pages/video/video',
						icon: 'iconfont icon-index-fill'
					},

				]
			}
		},
		onLoad() {

		},
		methods: {
			todetail() {
				uni.navigateTo({
					url: '../goods-detail/goods-detail'
				})
			},
			change(url) {
				console.log(url)
				uni.navigateTo({
					url
				})
			}
		}
	}
</script>

<style lang="scss">
	.title {
		color: #B50E03;
		letter-spacing: 23rpx;
		text-align: center;
		line-height: 100rpx;
		// margin-top: 10rpx;
		margin-bottom: 10rpx;
		width: 750rpx;
		height: 100rpx;
		background-color: #FFFFFF;
	}

	page {
		height: 100%;
	}



	swiper {
		width: 750rpx;
		height: 400rpx;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.nav {
		width: 750rpx;
		height: 200rpx;
		display: flex;

		.nav_item {
			text-align: center;
			// margin-left: 35rpx;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;

			// display: flex;
			.icon {
				line-height: 120rpx;
				width: 120rpx;
				height: 120rpx;
				border-radius: 60rpx;
				background-color: #EB4450;

				// font-size: 90rpx !important;
				view {
					font-size: 80rpx;
					color: #FFFFFF;
				}
			}

			.iconfont icon-index-fill {}

			// width: 25%;
			flex: 1;

			text {

				font-size: 36rpx;
			}
		}
	}
</style>
